package com.auto.Demo1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class ProcyInvocationHandler implements InvocationHandler {

   private rent rent;

    public void setRent(com.auto.Demo1.rent rent) {
        this.rent = rent;
    }

    public Object getProcy(){
      return   Proxy.newProxyInstance(this.getClass().getClassLoader(),rent.getClass().getInterfaces(),this);
    }


    //处理并返回代理实例，并饭hi结果
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Object result = method.invoke(rent, args);
        return result;
    }
}
